				<div id="address_list">
					<?php foreach ($deliverAddressArray as $index => $oneDeliverAddress) : ?>  
                    <p>
                        <input name="radio_address" type="radio" value="<?php echo $oneDeliverAddress->id?>" <?php echo set_radio('radio_address', $oneDeliverAddress->id, $oneDeliverAddress->isDefault=="yes"); ?>/>
                        <span class="old_address_user_name"><?php echo $oneDeliverAddress->name;?></span>
                        <span class="old_address_user_address"><?php echo $oneDeliverAddress->fullAddress;?></span>
                        <span class="old_address_user_phone">电话：<?php echo $oneDeliverAddress->phone;?></span>
                        <input type=hidden name="old_address[<?php echo $oneDeliverAddress->id;?>][deliverName]" value="<?php echo $oneDeliverAddress->name;?>">							
						<input type=hidden name="old_address[<?php echo $oneDeliverAddress->id;?>][deliverAddress]" value="<?php echo $oneDeliverAddress->fullAddress;?>">							
						<input type=hidden name="old_address[<?php echo $oneDeliverAddress->id;?>][deliverPhone]" value="<?php echo $oneDeliverAddress->phone;?>">							
						
                    </p>
					<?php endforeach; ?>
					<?php if(count($deliverAddressArray)>0):?>
                    <p>
                        <input name="radio_address" type="radio" value="new_address" <?php echo set_radio('radio_address', 'new_address'); ?>/>                    
                        <span>更换其他地址</span>
                    </p>
                    <?php else:?>
                    <p>
                        <input name="radio_address" type="hidden" value="new_address" checked="checked"/>
                    </p>
                    <?php endif;?>      
                </div>
                <?php if($userId ==0):?>
				<div id="loginNotice">
                	<span>已有送饭啦账户请<a href="<?php echo base_url().'login'?>">点此登录</a>，登录后将自动读取已有地址记录</span>
                </div>
                <?php endif;?>
				<div id="new_address" style="display:<?php echo selectNewAddress($deliverAddressArray);?>">
                    <table  id="new_address_table" >
                         <tbody>
                             <tr>
                                 <td class="new_address_left">收货人姓名<i>*</i></td>
                                 <td>
                                     <input type="text" id="deliverName" name="deliverName" value="<?php echo set_value('deliverName'); ?>"/>
                                     <input type="radio" value="male" name="user_sex" <?php echo set_radio('user_sex', 'male',true); ?>/>先生
                                     <input type="radio" value="female" name="user_sex" <?php echo set_radio('user_sex', 'female'); ?>/>女士
                                     <?php echo form_error('deliverName', '<span class="wrong_message">', '</span>'); ?>
                                 </td>
                             </tr>
                             <tr>
                                 <td class="new_address_left">收货人地址<i>*</i></td>
                                 <td>
                                     <input type="text" id="deliverAddress" name="deliverAddress" value="<?php echo set_value('deliverAddress'); ?>"/>
                                     <?php echo form_error('deliverAddress', '<span class="wrong_message">', '</span>'); ?>
                                 </td>
                             </tr>
                             <tr>
                                 <td class="new_address_left">收货人手机<i>*</i></td>
                                 <td>
                                    <input type="text" id="deliverPhone" name="deliverPhone" value="<?php echo set_value('deliverPhone'); ?>"/>
                                    <?php echo form_error('deliverPhone', '<span class="wrong_message">', '</span>'); ?>
                                 </td>
                             </tr>
                         </tbody>
                    </table>
                </div>
    
<?php 

function selectNewAddress($deliverAddressArray)
{
	if(count($deliverAddressArray)<=0)
	{
		return "";
	}
	
	if( isset($_POST['radio_address']) && ($_POST['radio_address']=='new_address') )
	{
		return "";
	}
	else
	{
		return "none";
	}
}
?>
    
